home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 94 / 094.d81 / source.sda / I-MENU V2 SOURCE < prev    next >
Text File  |  2022-08-26  |  5KB  |  502 lines

  1. ; * * * * INSTANT MENU * * * * 
  2. ;by Rick Nash
  3. ;This program will create a CRSR/RETURN menu
  4. ;from one sys
  5. ;sys,#items(+64 no screen save),x,y,box col+(64 double space)(+128 cancel),high,text,list$
  6.  
  7. .org $c800
  8. .obj "i-menu v2 c800"
  9.  
  10. jmp over'to'the'menu
  11. jmp screen'stash'enter
  12. jmp screen'restore'enter
  13.  
  14.  
  15. over'to'the'menu ldx #6
  16. stx numbers'to'get
  17. jsr get'number
  18.  
  19. lda number
  20. sta number+8
  21. and #15
  22. sta number
  23.  
  24. bit number+8
  25. bvs check'x'range
  26. bmi check'x'range
  27. lda #4
  28. sta screen
  29. jsr screen'stash
  30.  
  31. check'x'range lda number+1
  32. bne +
  33. jsr x'out
  34. + lda number+3
  35. bne +
  36. jsr x'out
  37.  
  38. + jsr line'links
  39. lda #0
  40. sta max
  41.   
  42. ldx number+2
  43. ldy number+1
  44. clc
  45. jsr $fff0
  46. jsr old'rom'patch
  47. lda number+5
  48. sta 646
  49.  
  50. lda number
  51. sta digit
  52.  
  53. - jsr get'string
  54. dec digit
  55. bne -
  56. beq +
  57.  
  58. menu'jump jmp menu
  59.  
  60. + bit number+3
  61. bmi menu'jump
  62.  
  63. box ldx number+2
  64. dex
  65. ldy number+1
  66. dey
  67. clc
  68. jsr $fff0
  69. jsr old'rom'patch
  70. lda number+3
  71. sta 646
  72.  
  73. lda #176
  74. jsr $ffd2
  75.  
  76. - lda #96
  77. jsr $ffd2
  78. lda 211
  79. cmp max
  80. bne -
  81.  
  82. lda #174
  83. jsr $ffd2
  84. inc 214
  85.  
  86. lda number
  87. sta digit
  88.  
  89. line ldx number+1
  90. dex
  91. stx 211
  92. jsr 58732
  93. jsr old'rom'patch
  94. lda #125
  95. jsr $ffd2
  96. lda max
  97. sta 211
  98. jsr 58732
  99. jsr old'rom'patch
  100. lda #125
  101. jsr $ffd2
  102.  
  103. bit number+3
  104. bvc after'double
  105.  
  106. lda digit
  107. cmp #1
  108. beq after'double
  109.  
  110. inc 214
  111. ldx number+1
  112. dex
  113. stx 211
  114. jsr 58732
  115. jsr old'rom'patch
  116. lda #171
  117. jsr $ffd2
  118.  
  119. - lda #96
  120. jsr $ffd2
  121. lda 211
  122. cmp max
  123. bne -
  124.  
  125. lda #179
  126. jsr $ffd2
  127.  
  128. after'double inc 214
  129. dec digit
  130. bne line
  131.  
  132. lda number+1
  133. sta 211
  134. dec 211
  135. jsr 58732
  136. jsr old'rom'patch
  137.  
  138. lda #173
  139. jsr $ffd2
  140.  
  141. - lda #96
  142. jsr $ffd2
  143. lda 211
  144. cmp max
  145. bne -
  146.  
  147. lda #189
  148. jsr $ffd2
  149.  
  150. menu lda #0
  151. sta item
  152. sta current
  153. sta previous
  154.  
  155. ldx number+2
  156. ldy #0
  157. clc
  158. jsr $fff0
  159. jsr old'rom'patch
  160. lda number+4
  161. sta digit
  162. jsr highlight'routine
  163.  
  164. get'key jsr $ffe4
  165. beq get'key
  166. cmp #17
  167. beq crsr'down
  168. cmp #145
  169. beq crsr'up
  170. cmp #13
  171. beq quit
  172. bne get'key
  173.  
  174. quit lda item
  175. clc
  176. adc #49
  177. sta 631
  178. lda #1
  179. sta 198
  180. bit number+8
  181. bvs +
  182. bmi +
  183. lda #4
  184. sta screen
  185. jsr screen'restore
  186. + jsr line'links
  187. rts
  188.  
  189. crsr'up lda item
  190. sta previous
  191. sec
  192. sbc #1
  193. bpl +
  194. ldx number
  195. dex
  196. txa
  197. + sta item
  198. jsr highlight
  199. jmp get'key
  200.  
  201. crsr'down lda item
  202. sta previous
  203. clc
  204. adc #1
  205. cmp number
  206. bne +
  207. lda #0
  208. + sta item
  209. jsr highlight
  210. jmp get'key
  211.  
  212. highlight lda previous
  213. bit number+3
  214. bvc +
  215. asl
  216. + clc
  217. adc number+2
  218. bit number+3
  219. tax
  220. ldy #0
  221. jsr $fff0
  222. jsr old'rom'patch
  223. lda number+5
  224. sta digit
  225. jsr highlight'routine
  226. lda item
  227. bit number+3
  228. bvc +
  229. asl
  230. + clc
  231. adc number+2
  232. tax
  233. ldy #0
  234. jsr $fff0
  235. jsr old'rom'patch
  236. lda number+4
  237. sta digit
  238. jsr highlight'routine
  239. rts
  240.  
  241. highlight'routine ldy number+1
  242. - lda (209),y
  243. eor #128
  244. sta (209),y
  245. lda digit
  246. sta (243),y
  247. iny
  248. cpy max
  249. bne -
  250. rts
  251.  
  252. ;**** get number from BASIC ****
  253.  
  254. get'number ldx #0
  255. stx current'number
  256.  
  257. - jsr $aefd
  258. jsr $ad8a
  259. jsr $b7f7
  260. lda $14  ; got it!
  261.  
  262. ldx current'number
  263. sta number,x
  264. inc current'number
  265. dec numbers'to'get
  266. beq +
  267. bne -
  268. + rts
  269.  
  270. ;***** get string from BASIC ****
  271.  
  272. get'string jsr $aefd
  273. jsr $ad9e
  274. jsr $b6a3
  275.  
  276. ldx $22
  277. ldy $23
  278. stx 251
  279. sty 252
  280. cmp #41
  281. bcc +
  282. lda #40
  283. + sta string'length
  284.  
  285. lda number+1
  286. sta 211
  287. jsr 58732
  288. jsr old'rom'patch
  289.  
  290. ldy #0
  291.  
  292. - lda (251),y
  293. jsr $ffd2
  294. iny
  295. cpy string'length
  296. bne -
  297. lda 211
  298. cmp max
  299. bcc +
  300. sta max
  301. + inc 214
  302. bit number+3
  303. bvc +
  304. inc 214
  305. + jsr 58732
  306. jsr old'rom'patch
  307.  
  308. lda max
  309. cmp #41
  310. bcc +
  311. jsr x'out
  312. + lda 214
  313. cmp #24
  314. bcc +
  315. jsr x'out
  316. + rts
  317.  
  318. ;**** Line Links ****
  319.  
  320. line'links ldy #24
  321. - lda 217,y
  322. ora #128
  323. sta 217,y
  324. dey
  325. bpl -
  326. rts
  327.  
  328. ;**** wait ****
  329.  
  330. wait lda 53265       
  331. bpl wait   
  332. rts
  333.  
  334. ;**** SCREEN STASH ****
  335.  
  336. screen'stash ldy screen
  337. cpy #9 ; ahem!  there are only 9 screens (0-8)
  338. bcc +
  339. rts
  340.  
  341. + sei
  342. ldx #0
  343. lda 1
  344. sta temp
  345. stx 1
  346. lda screens,y
  347. stx 253
  348. sta 254;  dest screen
  349. lda 648
  350. sta 252;  source screen
  351. ldy #0
  352. sty 251
  353.  
  354. ;begin copying
  355.  
  356. - lda (251),y
  357. sta (253),y
  358. iny
  359. bne -
  360. inx
  361. inc 254
  362. inc 252
  363.  
  364. cpx #4
  365. bne -
  366. ldx #0
  367.  
  368. lda #>55296
  369. sta 252
  370.  
  371. - dec 1
  372. lda (251),y
  373. inc 1
  374. sta (253),y
  375. iny
  376. bne -
  377. inc 252
  378. inc 254
  379. inx
  380. cpx #4
  381. bne -
  382.  
  383. lda temp
  384. sta 1
  385. cli
  386. lda 53280
  387. ldy number
  388. sta border,y
  389. lda 53281
  390. sta background,y
  391. rts
  392.  
  393. screen'restore ldy screen
  394. cpy #9 ; ahem!  there are only 9 screens (0-8)
  395. bcc +
  396. rts
  397.  
  398. / lda 53265
  399. bpl -
  400.  
  401. sei
  402. ldx #0
  403. lda 1
  404. sta temp
  405. stx 1
  406. lda screens,y
  407. stx 253
  408. sta 254;  source screen
  409. lda 648
  410. sta 252;  dest screen
  411. ldy #0
  412. sty 251
  413.  
  414. ;begin copying
  415.  
  416. - lda (253),y
  417. sta (251),y
  418. iny
  419. bne -
  420. inx
  421. inc 254
  422. inc 252
  423.  
  424. cpx #4
  425. bne -
  426. ldx #0
  427.  
  428. lda #>55296
  429. sta 252
  430.  
  431. - lda (253),y
  432. dec 1
  433. sta (251),y
  434. inc 1
  435. iny
  436. bne -
  437. inc 252
  438. inc 254
  439. inx
  440. cpx #4
  441. bne -  
  442.  
  443. lda temp
  444. sta 1
  445. cli
  446.  
  447. ldy number
  448. lda border,y
  449. sta 53280
  450. lda background,y
  451. sta 53281
  452. rts
  453.  
  454. x'out lda number+3
  455. ora #128
  456. sta number+3
  457. rts
  458.  
  459. screen'stash'enter ldx #1
  460. stx numbers'to'get
  461. jsr get'number
  462. lda number
  463. sta screen
  464. jmp screen'stash
  465.  
  466. screen'restore'enter ldx #1
  467. stx numbers'to'get
  468. jsr get'number
  469. lda number
  470. sta screen
  471. jmp screen'restore
  472.  
  473. old'rom'patch lda 210
  474. sec
  475. sbc 648
  476. clc
  477. adc #$d8
  478. sta 244
  479. lda 209
  480. sta 243
  481. rts
  482.  
  483. device .byt 8
  484. numbers'to'get .buf 1
  485. current'number .buf 1
  486. string'len .buf 2
  487. number .buf 9
  488. digit .byt 0
  489. max .byt 0
  490. temp .byt 0
  491. current .byt 0
  492. previous .byt 0
  493. item .byt 0
  494. flag .byt 0
  495. string'length .buf 2
  496. screen .byt 0
  497. screens .byt $a0,$a8,$b0,$b8,$d0,$d8,$e0,$e8,$f0
  498. border .buf 9
  499. background .buf 9
  500.  
  501.  
  502.